<template>
  <div>
    <div class="biggest_box_container">
      <div class="center_box_container">
        <div class="top_box_container">
          <div class="image_box_container">
            <img src="../assets/logo.png" />
          </div>
        </div>
        <div class="bottom_box_container">
          <div class="import_box_container">
            <div class="input_box_container">
              <el-input placeholder="请输入内容" class="input" v-model="input1">
                <i slot="prefix" class="el-icon-user"></i>
              </el-input>
              <div class="brace_box_container"></div>
              <el-input placeholder="请输入内容" class="input" v-model="input2">
                <i slot="prefix" class="el-icon-lock"></i>
              </el-input>
            </div>
            <div class="button_box_container">
              <div class="button2_box_con">
                <el-button type="primary" @click="onclickLogin">登录</el-button>
                <el-button type="info" @click="onclickReset">重置</el-button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      input1: "",
      input2: "",
    };
  },
  methods: {
    onclickLogin() {
      this.$axios
        .post(
          "https://www.liulongbin.top:8888/api/private/v1/login",
          {
            username: this.input1,
            password: this.input2,
          }
        )
        .then((res) => {
          console.log(res);
          alert("登陆成功");
          localStorage.setItem("token", res.data.data.token);
          this.$router.push({ path: "/page/userlist" });
        })
        .catch(() => {
          alert("登陆失败");
        });
    },
    onclickReset() {
      //重置
      this.input1 = "";
      this.input2 = "";
    },
  },
};
</script>
<style lang="scss">
* {
  margin: 0;
  padding: 0;
}
.biggest_box_container {
  width: 100vw;
  height: 100vh;
  background-color: #2b4b6b;
  display: inline-flex;
  justify-content: center;
  align-content: center;
  align-items: center;
}
.center_box_container {
  width: 600px;
  height: 400px;
  // background-color: #f4f4f4;
  position: relative;
}
.top_box_container {
  width: 100%;
  height: 20%;
  // background-color: red;
  display: inline-flex;
  justify-content: center;
  align-content: center;
}
.image_box_container {
  width: 100px;
  height: 100px;
  background-color: #eeeeee;
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-content: center;
  align-items: center;
  z-index: 666;

  img {
    width: 90px;
    height: 90px;
  }
}
.bottom_box_container {
  width: 100%;
  height: 90%;
  background-color: #ffffff;
  border: 1px solid;
  position: absolute;
  bottom: 10px;
}
.import_box_container {
  width: 100%;
  height: 300px;
  // background-color: springgreen;
  margin-top: 100px;
}
.input_box_container {
  width: 100%;
  height: 40%;
  // background-color: yellow;
  .input {
    width: 90%;
    margin-left: 25px;
  }
  .el-icon-user {
    margin-top: 10px;
  }
}
.brace_box_container {
  width: 100%;
  height: 20px;
}
.button_box_container {
  width: 100%;
  height: 30%;
  // background-color: violet;
  // display: inline-flex;
  position: relative;
}
.button2_box_con {
  width: 220px;
  // background-color: yellow;
  // margin-left: 90px;
  position: absolute;
  right: 0px;
}
</style>
